/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ManagerWindow.java
 *
 * Created on Aug 1, 2011, 12:26:44 AM
 */
package INTROSE_MP;

import com.mysql.jdbc.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
import java.sql.Connection;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Paolo
 */
public class ManagerWindow extends javax.swing.JFrame {
    public static Connection conn;
    private DefaultTableModel viewModel;
    private DefaultTableModel prodModel;
    private DefaultTableModel clientModel;
    private static Statement stmt;
    private static PreparedStatement pstmt;
    private static ResultSet rset;
    private static ResultSet rsetProd;
    private static ResultSet rsetClients;
    private LoginWindow l = new LoginWindow();
    /** Creates new form ManagerWindow */
    public ManagerWindow() {
       viewModel = new DefaultTableModel();
       prodModel = new DefaultTableModel();
       clientModel = new DefaultTableModel();
      
       
       initComponents();
       
       prodSearchOptions.setSelectedIndex(0);
       prodModel.addColumn("Product Code");
       prodModel.addColumn("Product Name");
       prodModel.addColumn("Size");
       prodModel.addColumn("Price");
       prodModel.addColumn("Stock");
       prodModel.addColumn("Status");
       prodTable.setModel(prodModel);
       
       rsetProd = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product");
       fillViewProducts(rsetProd);
       
       viewModel.addColumn("Order Code");
       viewModel.addColumn("Client ID");
       viewModel.addColumn("Product Quantity");
       viewModel.addColumn("Date Ordered");
       viewModel.addColumn("Status");
       orderTable.setModel(viewModel);
       
       rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order GROUP BY ordercode");
       fillViewOrders(rset);
       
       clientModel.addColumn("Client ID");
       clientModel.addColumn("Client Name");
       clientModel.addColumn("Client Address");
       clientTable.setModel(clientModel);
       
       rsetClients = Main.doSelect("SELECT clientID, clientname, CONCAT(street, city) FROM introse.client");
       fillViewClients(rsetClients);
    }
    
private void fillViewProducts(ResultSet rSet)
    { DefaultTableModel dm = (DefaultTableModel)prodTable.getModel();
      dm.getDataVector().removeAllElements();
        try {
            while(rSet.next())
            { Vector<String> row = new Vector<String>();
              row.add(rSet.getInt(1)+"");
              row.add(rSet.getString(2)+"");
              row.add(rSet.getString(3)+"");
              row.add(rSet.getInt(4)+"");
              row.add(rSet.getInt(5)+"");
              row.add(rSet.getString(6)+"");
              prodModel.addRow(row);
              
            }
        } catch (SQLException ex) {
            Logger.getLogger(OrderForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
 private void fillViewOrders(ResultSet rSet)
    { DefaultTableModel dm = (DefaultTableModel)orderTable.getModel();
      dm.getDataVector().removeAllElements();
        try {
            while(rSet.next())
            { Vector<String> row = new Vector<String>();
              row.add(rSet.getInt(1)+"");
              row.add(rSet.getInt(2)+"");
              row.add(rSet.getInt(3)+"");
              row.add(rSet.getDate(4)+"");
              row.add(rSet.getString(5));
              viewModel.addRow(row);
              
            }
        } catch (SQLException ex) {
            Logger.getLogger(OrderForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
 
 private void fillViewClients(ResultSet rSet)
 {
     DefaultTableModel dm = (DefaultTableModel)clientTable.getModel();
     dm.getDataVector().removeAllElements();
     try{
         while(rSet.next())
         {Vector<String> row = new Vector<String>();
         row.add(rSet.getInt(1)+"");
         row.add(rSet.getString(2));
         row.add(rSet.getString(3));
         clientModel.addRow(row);
             
         }
     }catch (SQLException ex){
         Logger.getLogger(OrderForm.class.getName()).log(Level.SEVERE, null, ex);
     }
 }
 

  
 

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        logoutButton = new javax.swing.JButton();
        managerPane = new javax.swing.JTabbedPane();
        prodPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        prodTable = new javax.swing.JTable();
        prodSearchPanel = new javax.swing.JPanel();
        prodSearchBar = new javax.swing.JTextField();
        prodSearchButton = new javax.swing.JButton();
        prodSearchOptions = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        prodAddButton = new javax.swing.JButton();
        prodEditButton = new javax.swing.JButton();
        prodViewCritButton = new javax.swing.JButton();
        prodViewCritButton1 = new javax.swing.JButton();
        orderPanel = new javax.swing.JPanel();
        orderSearchPanel = new javax.swing.JPanel();
        orderSearchBar = new javax.swing.JTextField();
        orderSearchButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        clientSearch = new javax.swing.JRadioButton();
        orderCodeSearch = new javax.swing.JRadioButton();
        dateSearch = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        orderAddButton = new javax.swing.JButton();
        deliveredButton = new javax.swing.JButton();
        fillTableButton = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        orderTable = new javax.swing.JTable();
        clientPanel = new javax.swing.JPanel();
        clientSearchPanel = new javax.swing.JPanel();
        prodSearchBar2 = new javax.swing.JTextField();
        clientSearchButton = new javax.swing.JButton();
        clientIDRB = new javax.swing.JRadioButton();
        clientNameRB = new javax.swing.JRadioButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        clientTable = new javax.swing.JTable();
        clientAddButton = new javax.swing.JButton();
        clientEditButton = new javax.swing.JButton();
        clientDelButton = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        reportPanel = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        reportTable = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Manager's Window - Pusong Pinoy");
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        logoutButton.setText("Logout");
        logoutButton.setFocusable(false);
        logoutButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        logoutButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        logoutButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logoutButtonActionPerformed(evt);
            }
        });
        getContentPane().add(logoutButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 10, -1, -1));

        prodPanel.setBackground(new java.awt.Color(19, 145, 217));

        prodTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Product Code", "Product Name", "Size", "Price", "Stock", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(prodTable);
        prodTable.getColumnModel().getColumn(0).setResizable(false);
        prodTable.getColumnModel().getColumn(1).setResizable(false);
        prodTable.getColumnModel().getColumn(2).setResizable(false);
        prodTable.getColumnModel().getColumn(3).setResizable(false);
        prodTable.getColumnModel().getColumn(4).setResizable(false);
        prodTable.getColumnModel().getColumn(5).setResizable(false);

        prodSearchPanel.setBackground(new java.awt.Color(19, 145, 217));
        prodSearchPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Products"));

        prodSearchButton.setText("Search");
        prodSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodSearchButtonActionPerformed(evt);
            }
        });

        prodSearchOptions.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Product Code", "Product Name", "Size", "Price" }));

        jLabel2.setText("Search Value:");

        jLabel3.setText("Search by:");

        javax.swing.GroupLayout prodSearchPanelLayout = new javax.swing.GroupLayout(prodSearchPanel);
        prodSearchPanel.setLayout(prodSearchPanelLayout);
        prodSearchPanelLayout.setHorizontalGroup(
            prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, prodSearchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(prodSearchPanelLayout.createSequentialGroup()
                        .addComponent(prodSearchOptions, 0, 185, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(prodSearchButton))
                    .addComponent(prodSearchBar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE))
                .addContainerGap())
        );
        prodSearchPanelLayout.setVerticalGroup(
            prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(prodSearchPanelLayout.createSequentialGroup()
                .addGroup(prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(prodSearchBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(11, 11, 11)
                .addGroup(prodSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(prodSearchButton)
                    .addComponent(jLabel3)
                    .addComponent(prodSearchOptions, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        prodAddButton.setText("Add Product");
        prodAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodAddButtonActionPerformed(evt);
            }
        });

        prodEditButton.setText("Edit Product Info");
        prodEditButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodEditButtonActionPerformed(evt);
            }
        });

        prodViewCritButton.setText("View Critical Products");
        prodViewCritButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodViewCritButtonActionPerformed(evt);
            }
        });

        prodViewCritButton1.setText("View All Products");
        prodViewCritButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodViewCritButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout prodPanelLayout = new javax.swing.GroupLayout(prodPanel);
        prodPanel.setLayout(prodPanelLayout);
        prodPanelLayout.setHorizontalGroup(
            prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, prodPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 743, Short.MAX_VALUE)
                    .addGroup(prodPanelLayout.createSequentialGroup()
                        .addComponent(prodSearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE)
                        .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(prodViewCritButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(prodViewCritButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(prodAddButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(prodEditButton, javax.swing.GroupLayout.Alignment.TRAILING))))
                .addContainerGap())
        );
        prodPanelLayout.setVerticalGroup(
            prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(prodPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(prodPanelLayout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(prodAddButton)
                            .addComponent(prodViewCritButton1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(prodPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(prodEditButton)
                            .addComponent(prodViewCritButton)))
                    .addGroup(prodPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(prodSearchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        managerPane.addTab("Products", prodPanel);

        orderPanel.setBackground(new java.awt.Color(19, 145, 217));

        orderSearchPanel.setBackground(new java.awt.Color(19, 145, 217));
        orderSearchPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Orders"));

        orderSearchButton.setText("Search");
        orderSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                orderSearchButtonActionPerformed(evt);
            }
        });

        jLabel1.setText("Search Value:");

        clientSearch.setBackground(new java.awt.Color(19, 145, 217));
        buttonGroup1.add(clientSearch);
        clientSearch.setSelected(true);
        clientSearch.setText("Client ID");
        clientSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientSearchActionPerformed(evt);
            }
        });

        orderCodeSearch.setBackground(new java.awt.Color(19, 145, 217));
        buttonGroup1.add(orderCodeSearch);
        orderCodeSearch.setText("Order Code");

        dateSearch.setBackground(new java.awt.Color(19, 145, 217));
        buttonGroup1.add(dateSearch);
        dateSearch.setText("Date Ordered");

        jLabel4.setText("Search by:");

        javax.swing.GroupLayout orderSearchPanelLayout = new javax.swing.GroupLayout(orderSearchPanel);
        orderSearchPanel.setLayout(orderSearchPanelLayout);
        orderSearchPanelLayout.setHorizontalGroup(
            orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderSearchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(orderCodeSearch)
                    .addGroup(orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(orderSearchPanelLayout.createSequentialGroup()
                            .addComponent(clientSearch)
                            .addGap(18, 18, 18)
                            .addComponent(dateSearch)
                            .addGap(21, 21, 21)
                            .addComponent(orderSearchButton))
                        .addComponent(orderSearchBar)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        orderSearchPanelLayout.setVerticalGroup(
            orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(orderSearchPanelLayout.createSequentialGroup()
                .addGroup(orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(orderSearchBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(orderSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(orderSearchButton)
                    .addComponent(clientSearch)
                    .addComponent(jLabel4)
                    .addComponent(dateSearch))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(orderCodeSearch)
                .addContainerGap())
        );

        orderAddButton.setText("Add Order");
        orderAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                orderAddButtonActionPerformed(evt);
            }
        });

        deliveredButton.setText("Delivered");
        deliveredButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deliveredButtonActionPerformed(evt);
            }
        });

        fillTableButton.setText("Fill Table");
        fillTableButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fillTableButtonActionPerformed(evt);
            }
        });

        orderTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Client ID", "Client Name", "Product Ordered", "Quantity", "Date Ordered", "Status"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(orderTable);
        orderTable.getColumnModel().getColumn(0).setResizable(false);
        orderTable.getColumnModel().getColumn(1).setResizable(false);
        orderTable.getColumnModel().getColumn(2).setResizable(false);
        orderTable.getColumnModel().getColumn(3).setResizable(false);
        orderTable.getColumnModel().getColumn(4).setResizable(false);
        orderTable.getColumnModel().getColumn(5).setResizable(false);

        javax.swing.GroupLayout orderPanelLayout = new javax.swing.GroupLayout(orderPanel);
        orderPanel.setLayout(orderPanelLayout);
        orderPanelLayout.setHorizontalGroup(
            orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, orderPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 743, Short.MAX_VALUE)
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addComponent(orderSearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 236, Short.MAX_VALUE)
                        .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(deliveredButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(fillTableButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(orderAddButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        orderPanelLayout.setVerticalGroup(
            orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, orderPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(orderPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(orderPanelLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(orderAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(deliveredButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(fillTableButton))
                    .addComponent(orderSearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(187, 187, 187))
        );

        managerPane.addTab("Orders", orderPanel);

        clientPanel.setBackground(new java.awt.Color(19, 145, 217));

        clientSearchPanel.setBackground(new java.awt.Color(19, 145, 217));
        clientSearchPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Search Clients"));
        clientSearchPanel.setPreferredSize(new java.awt.Dimension(370, 113));

        clientSearchButton.setText("Search");
        clientSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientSearchButtonActionPerformed(evt);
            }
        });

        clientIDRB.setBackground(new java.awt.Color(19, 145, 217));
        buttonGroup2.add(clientIDRB);
        clientIDRB.setText("by Client ID");

        clientNameRB.setBackground(new java.awt.Color(19, 145, 217));
        buttonGroup2.add(clientNameRB);
        clientNameRB.setText("by Client Name");
        clientNameRB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientNameRBActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout clientSearchPanelLayout = new javax.swing.GroupLayout(clientSearchPanel);
        clientSearchPanel.setLayout(clientSearchPanelLayout);
        clientSearchPanelLayout.setHorizontalGroup(
            clientSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(clientSearchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(clientSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(prodSearchBar2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 334, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, clientSearchPanelLayout.createSequentialGroup()
                        .addGroup(clientSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(clientIDRB)
                            .addComponent(clientNameRB))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 146, Short.MAX_VALUE)
                        .addComponent(clientSearchButton)))
                .addContainerGap())
        );
        clientSearchPanelLayout.setVerticalGroup(
            clientSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(clientSearchPanelLayout.createSequentialGroup()
                .addComponent(prodSearchBar2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(clientSearchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(clientSearchButton)
                    .addComponent(clientIDRB))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(clientNameRB)
                .addGap(15, 15, 15))
        );

        clientTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Client ID", "Client Name", "Client Address"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(clientTable);
        clientTable.getColumnModel().getColumn(0).setResizable(false);
        clientTable.getColumnModel().getColumn(1).setResizable(false);
        clientTable.getColumnModel().getColumn(2).setResizable(false);

        clientAddButton.setText("Add Client");
        clientAddButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientAddButtonActionPerformed(evt);
            }
        });

        clientEditButton.setText("Edit Client Info");
        clientEditButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientEditButtonActionPerformed(evt);
            }
        });

        clientDelButton.setText("Delete Client");

        jButton3.setText("Fill Table");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout clientPanelLayout = new javax.swing.GroupLayout(clientPanel);
        clientPanel.setLayout(clientPanelLayout);
        clientPanelLayout.setHorizontalGroup(
            clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(clientPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 743, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, clientPanelLayout.createSequentialGroup()
                        .addComponent(clientSearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(256, 256, 256)
                        .addGroup(clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(clientDelButton, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
                            .addGroup(clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(clientAddButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(clientEditButton, javax.swing.GroupLayout.Alignment.LEADING))
                            .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE))))
                .addContainerGap())
        );
        clientPanelLayout.setVerticalGroup(
            clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, clientPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(clientPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(clientPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(clientSearchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(clientPanelLayout.createSequentialGroup()
                        .addGap(5, 5, 5)
                        .addComponent(clientAddButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(clientEditButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(clientDelButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)))
                .addGap(167, 167, 167))
        );

        managerPane.addTab("Clients", clientPanel);

        reportPanel.setBackground(new java.awt.Color(19, 145, 217));

        reportTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Date", "Orders Received", "Orders Completed"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane4.setViewportView(reportTable);
        reportTable.getColumnModel().getColumn(0).setResizable(false);
        reportTable.getColumnModel().getColumn(1).setResizable(false);
        reportTable.getColumnModel().getColumn(2).setResizable(false);

        jButton2.setText("Show Report");

        jButton1.setText("Save Report");

        javax.swing.GroupLayout reportPanelLayout = new javax.swing.GroupLayout(reportPanel);
        reportPanel.setLayout(reportPanelLayout);
        reportPanelLayout.setHorizontalGroup(
            reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(reportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 743, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, reportPanelLayout.createSequentialGroup()
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)))
                .addContainerGap())
        );
        reportPanelLayout.setVerticalGroup(
            reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(reportPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 347, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(reportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        managerPane.addTab("Reports", reportPanel);

        getContentPane().add(managerPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 772, 430));

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BG.jpg"))); // NOI18N
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(-90, 0, 900, 470));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void prodEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodEditButtonActionPerformed
        // TODO add your handling code here:
        int r = prodTable.getSelectedRow();
        String prodName = (String) prodTable.getValueAt(r, 1);
        String size = (String) prodTable.getValueAt(r, 2);
        String price = (String) prodTable.getValueAt(r, 3);
        String stock = (String) prodTable.getValueAt(r, 3);
        
        
        ProductForm ProdForm = new ProductForm(this, prodName, size, price, stock);
        ProdForm.setVisible(true);
        ProdForm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        ProdForm.setLocationRelativeTo(null);
    }//GEN-LAST:event_prodEditButtonActionPerformed

    private void logoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logoutButtonActionPerformed
        // TODO add your handling cthis.dispose();
        this.dispose();
        l.setVisible(true);
        l.setLocationRelativeTo(null);
    }//GEN-LAST:event_logoutButtonActionPerformed

    private void deliveredButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deliveredButtonActionPerformed
        // TODO add your handling code here:
    int ordercode;
     String status="Delivered";
     String statusCheck="";
     statusCheck = (String)orderTable.getModel().getValueAt(orderTable.getSelectedRow(), 4);
     if(!statusCheck.equals(status)){
    try{
        ordercode = Integer.parseInt((String)(orderTable.getModel().getValueAt(orderTable.getSelectedRow(), 0)));
        
        Main.updateStatus(status, ordercode);
        rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order GROUP BY ordercode");
        fillViewOrders(rset);
    
        }catch(ArrayIndexOutOfBoundsException e){
            JOptionPane.showMessageDialog(this, "Please select an order.");
            }
     }
     else
     JOptionPane.showMessageDialog(this, "Order already delivered.");
    }//GEN-LAST:event_deliveredButtonActionPerformed

    private void clientNameRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientNameRBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_clientNameRBActionPerformed

    private void clientEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientEditButtonActionPerformed
        // TODO add your handling code here:
       /* ClientForm ClieForm = new ClientForm();
        CliForm.setVisible(true);
        CliForm.setLocationRelativeTo(null);*/
}//GEN-LAST:event_clientEditButtonActionPerformed

    private void clientAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientAddButtonActionPerformed
        // TODO add your handling code here:
       /* ClientForm CliForm = new ClientForm();
        CliForm.setVisible(true);
        CliForm.setLocationRelativeTo(null);   */     
    }//GEN-LAST:event_clientAddButtonActionPerformed

    private void prodAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodAddButtonActionPerformed
        // TODO add your handling code here:
        
        ProductForm ProdForm = new ProductForm(this, null, null, null, null);
        ProdForm.setVisible(true);
        ProdForm.setLocationRelativeTo(null);
        ProdForm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        this.setEnabled(false);
    }//GEN-LAST:event_prodAddButtonActionPerformed

    private void orderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderAddButtonActionPerformed
        // TODO add your handling code here:
        
        OrderForm OrdForm = new OrderForm();
        OrdForm.setVisible(true);
        OrdForm.setLocationRelativeTo(null);
        OrdForm.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        this.setEnabled(false);
        
    }//GEN-LAST:event_orderAddButtonActionPerformed

private void fillTableButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fillTableButtonActionPerformed
// TODO add your handling code here:

    rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order GROUP BY ordercode");
        fillViewOrders(rset);

     
}//GEN-LAST:event_fillTableButtonActionPerformed

private void orderSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderSearchButtonActionPerformed
// TODO add your handling code here:

    
    if(clientSearch.isSelected())
    {   int clientQuery = Integer.parseInt(orderSearchBar.getText());
        rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order where clientID='"+clientQuery+"'");
        fillViewOrders(rset);
    }
    if(orderCodeSearch.isSelected()){
        int codeQuery = Integer.parseInt(orderSearchBar.getText());
        rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order where ordercode='"+codeQuery+"'");
        fillViewOrders(rset);
    }
//     if(dateSearch.isSelected()){
//           String dateQuery = orderSearchBar.getText();
//         try {
//                rset = Main.doSelect("SELECT ordercode,clientID,count(*),dateordered,status FROM introse.order where dateordered='"+dateQuery+"'");
//                while(rset.next()){
//                fillViewOrders(rset);}
//            } catch (SQLException ex) {
//                Logger.getLogger(ManagerWindow.class.getName()).log(Level.SEVERE, null, ex);
//            }
//    }
}//GEN-LAST:event_orderSearchButtonActionPerformed

private void clientSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientSearchActionPerformed
// TODO add your handling code here:

}//GEN-LAST:event_clientSearchActionPerformed

private void prodViewCritButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodViewCritButton1ActionPerformed
    // TODO add your handling code here:
    rsetProd = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product");
    fillViewProducts(rsetProd);
}//GEN-LAST:event_prodViewCritButton1ActionPerformed

private void prodSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodSearchButtonActionPerformed
    // TODO add your handling code here:
    
    if(prodSearchOptions.getSelectedIndex() == 0){
        int prodCodeQuery = Integer.parseInt(prodSearchBar.getText());
        rset = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product WHERE productcode='"+prodCodeQuery+"'");
        fillViewProducts(rset);
    }
    
    else if(prodSearchOptions.getSelectedIndex() == 1){
        String prodNameQuery = prodSearchBar.getText();
        rset = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product WHERE product_name LIKE'"+prodNameQuery+"%'");
        fillViewProducts(rset);
    }
    
    else if(prodSearchOptions.getSelectedIndex() == 2){
        String prodSizeQuery = prodSearchBar.getText();
        rset = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product WHERE size='"+prodSizeQuery+"'");
        fillViewProducts(rset);
    }
    
    else if(prodSearchOptions.getSelectedIndex() == 3){
        int prodPriceQuery = Integer.parseInt(prodSearchBar.getText());
        rset = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product WHERE price='"+prodPriceQuery+"'");
        fillViewProducts(rset);
    }
        
       
}//GEN-LAST:event_prodSearchButtonActionPerformed

private void prodViewCritButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodViewCritButtonActionPerformed
    // TODO add your handling code here:
    rsetProd = Main.doSelect("SELECT productcode,product_name,size,price,quantity,item_status FROM introse.product WHERE item_status='Critical'");
    fillViewProducts(rsetProd);
}//GEN-LAST:event_prodViewCritButtonActionPerformed

private void clientSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientSearchButtonActionPerformed
// TODO add your handling code here:
        
    if(clientIDRB.isSelected())
    {
        int clientIDQuery = Integer.parseInt(prodSearchBar2.getText());
        rsetClients = Main.doSelect("SELECT clientID, clientname, CONCAT(street, city) FROM introse.client WHERE clientID ='"+clientIDQuery+"'");
        fillViewClients(rsetClients);
        
    }
    
    if(clientNameRB.isSelected())
    {
        String clientNameQuery = prodSearchBar2.getText();
        rsetClients = Main.doSelect("SELECT clientID, clientname, CONCAT(street, city) FROM introse.client WHERE clientname='"+clientNameQuery+"'");
        fillViewClients(rsetClients);
        
    }
}//GEN-LAST:event_clientSearchButtonActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    
    rsetClients = Main.doSelect("SELECT clientID, clientname, CONCAT(street, city) FROM introse.client GROUP BY clientID");
        fillViewClients(rsetClients);
}//GEN-LAST:event_jButton3ActionPerformed

    /**
     * @param args the command line arguments
     */
    /**public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ManagerWindow().setVisible(true);
            }
        });
    }**/

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton clientAddButton;
    private javax.swing.JButton clientDelButton;
    private javax.swing.JButton clientEditButton;
    private javax.swing.JRadioButton clientIDRB;
    private javax.swing.JRadioButton clientNameRB;
    private javax.swing.JPanel clientPanel;
    private javax.swing.JRadioButton clientSearch;
    private javax.swing.JButton clientSearchButton;
    private javax.swing.JPanel clientSearchPanel;
    private javax.swing.JTable clientTable;
    private javax.swing.JRadioButton dateSearch;
    private javax.swing.JButton deliveredButton;
    private javax.swing.JButton fillTableButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JButton logoutButton;
    private javax.swing.JTabbedPane managerPane;
    private javax.swing.JButton orderAddButton;
    private javax.swing.JRadioButton orderCodeSearch;
    private javax.swing.JPanel orderPanel;
    private javax.swing.JTextField orderSearchBar;
    private javax.swing.JButton orderSearchButton;
    private javax.swing.JPanel orderSearchPanel;
    private javax.swing.JTable orderTable;
    private javax.swing.JButton prodAddButton;
    private javax.swing.JButton prodEditButton;
    private javax.swing.JPanel prodPanel;
    private javax.swing.JTextField prodSearchBar;
    private javax.swing.JTextField prodSearchBar2;
    private javax.swing.JButton prodSearchButton;
    private javax.swing.JComboBox prodSearchOptions;
    private javax.swing.JPanel prodSearchPanel;
    private javax.swing.JTable prodTable;
    private javax.swing.JButton prodViewCritButton;
    private javax.swing.JButton prodViewCritButton1;
    private javax.swing.JPanel reportPanel;
    private javax.swing.JTable reportTable;
    // End of variables declaration//GEN-END:variables
}
